// Copyright (c) 2010 Manuel Peinado Gallego <manuel.peinado@gmail.com>
// Distributed under the MIT license

#include "stdafx.h"
#include "WorldBuilder.h"
#include "MarkerNode.h"
#include "View3d.h"
#include "Sphere.h"
#include "AABB.h"

MarkerNode::MarkerNode()
{
}

bool MarkerNode::canBeDrawnImpl() const 
{ 
    return true; 
}

bool MarkerNode::isBoundedImpl() const
{
    return true;
}

void MarkerNode::draw(View3d * view) const
{
    bool selNode = view->isDrawingInPickMode();

    if(!selNode)
    {
        glPushAttrib(GL_CURRENT_BIT);
        glColor3d(1., 0., 0.);
    }

    glutSolidSphere(.05, 10, 10);

    if(!selNode)
    {
        glPopAttrib();
    }
}

AABB MarkerNode::getAabbLocalImpl() const
{
    // TODO make this depend on camera eye position
    return Sphere(gx::zero, 0.05).getAabb();
}

